f = Sin() ∘ (1 / Polynomial(0, 1, d=0.0 .. 0.05))
fplot(f, yscale=0.05, npoints=11)4 Mathematics
4.1 Mappings
s = Sin(0 .. 3π)
c = Cos(0 .. 3π)
f = 2s
g = s + f'
p = 1 / 20 * Polynomial([2, -1], 1 .. 8) * Polynomial([3, -1]) * Polynomial([4.5, -1]) * Polynomial([8, -1])
fplot(c, s, g, p)f = Polynomial([0, 1], -1 .. 1)
F = antiderivative(f)
fplot(f, F)integrate(f, 0 .. 1)0.5
p = [0, 1, 2]
f = fplot(fromroots(p, -0.1 .. 2.1))
cm.scatter!(p, 0 * p, color=:tomato)
fp = [0, 1.5, 2]
f = fplot(lagrangepolynomials(p, 0 .. 2)...)
cm.scatter!(p, [0, 0, 0], color=:tomato)
cm.scatter!(p, [1, 1, 1], color=:blue)
f4.1.1 Parametric curves
Lissajous curve
u = ParametricCurve(Cos(0 .. 2π), Sin() ∘ Polynomial(0, 2, d=0 .. 2pi))
v = 0.075 * Sin() ∘ Polynomial(0, 100) * UnitNormal(u)
w = 0.025 * ParametricCurve(Sin(), Cos()) ∘ Polynomial(0, 200)
fplot(u, u + v, u + w)pts = tomatrix([[0.0, 0], [1.5, 1], [2, 0], [1.5, -1], [0, 0]])
fig, ax = fplot(Interpolation(pts, 1))
cm.scatter!(ax, pts, color=:tomato)
fig4.1.2 Monomials
fplot(monomials(0:100, 0 .. 1)...)4.1.3 Hermite like polynomials with middle node
Compute polynomials
h = 2.0
N = [ValueAtLF.(0:h/2:h); DerivativeAtLF.([0, h])] |> vcat
P = monomials(0:length(N)-1, 0 .. h)
M = [n(p) for p in P, n in N]
H = inv(M) * P
fplot(H...)4.2 Functions of two variables
This part is in a very early stage of development.
Create the function \(f : [0, 5\pi]^2 \to \mathbb{R}, \quad f(\mathbf{x}) = \sin x_1 \sin x_2\)
f = makefunction(x -> sin(x[1]) * sin(x[2]), 0 .. 5π, 0 .. 5π)(::AdHocMapping{StaticArraysCore.SVector{2, Float64}, Real, (0.0 .. 15.708) × (0.0 .. 15.708)}) (generic function with 2 methods)
By default the plot is a view down from positive \(z\) direction
fplot3d(f, mesh=9)Create a 3D plot using Axis3 and switch of the mesh since CairoMakie does not handle hidden lines.
fig = Figure()
ax3d = Axis3(fig[1, 1])
fplot3d!(ax3d, f, npoints=250, mesh=nothing)
figA (sometimes?) interactive 3D plot is obtained using WebGL:
WGLMakie.activate!()
fig = Figure()
ax3d = Axis3(fig[1, 1])
fplot3d!(ax3d, f, mesh=19, npoints=250)
fig